package collection_job;

import java.util.ArrayList;
import java.util.List;

public class ListDemo2 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        System.out.println("list:"+list);//one, two, three, four

        String e=list.get(3);
        System.out.println(e);//four

        list.set(3,"five");
        System.out.println(list);//one, two, three,five

        list.remove(0);
        System.out.println(list);//two, three,five

        list.add(2,"four");
        System.out.println(list);//two, three,four,five

        List<String> s=list.subList(1,2);
        System.out.println(s);//three




    }
}
